package com.kandinfo.isbnmanage.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kandinfo.isbnmanage.dto.IsbnCirculationDto;
import com.kandinfo.isbnmanage.dto.IsbnCirculationReqDto;
import com.kandinfo.isbnmanage.service.IsbnCirculationService;

/**
 * 暂定：流转记录相关查询
 * 
 * @author chenziping
 *
 */
@Controller
@RequestMapping(value = "/isbnCirculation")
public class IsbnCirculationController {

	@Autowired
	IsbnCirculationService isbnCirculationService;
	
	/**
	 * 流转记录页面
	 * 
	 * @param model
	 * @param barcode
	 * @return
	 */
	@RequestMapping(value = "/index", method = RequestMethod.GET)
	private String index(Model model, @RequestParam String barcode) {
		model.addAttribute("barcode", barcode);
		return "isbnmanage/isbn_circu";
	}

	@RequestMapping(value = "/getCircuInfo", method = RequestMethod.POST)
	@ResponseBody
	private List<IsbnCirculationDto> getCircuInfo(@RequestBody IsbnCirculationReqDto reqDto) {
		return isbnCirculationService.getCircuInfo(reqDto);
	}
	
}
